<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/bootstrap/js/bootstrap.min.js"></script>

<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/static/h-ui.admin/js/CH-ui.js"></script>


<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/lightbox2/2.8.1/js/lightbox.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/bootstrap/js/bootstrap-datetimepicker.fr.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/bootstrap/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/bootstrap/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/lib/wangEditor.min.js"></script>






<script>
    $('#datetimepicker2').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',  //显示格式可为yyyymm/yyyy-mm-dd/yyyy.mm.dd
        weekStart: 1,  	//0-周日,6-周六 。默认为0
        autoclose: true,
        startView: 3,  	//打开时显示的视图。0-'hour' 1-'day' 2-'month' 3-'year' 4-'decade'
        minView: 0,  	//最小时间视图。默认0-'hour'
        maxView: 4, 	//最大时间视图。默认4-'decade'
        todayBtn:true, 	//true时"今天"按钮仅仅将视图转到当天的日期。如果是'linked'，当天日期将会被选中。
        todayHighlight:true,	//默认值: false,如果为true, 高亮当前日期。
        initialDate: new Date(),	//初始化日期.默认new Date()当前日期
        forceParse: false,  	//当输入非格式化日期时，强制格式化。默认true
        bootcssVer:3,	//显示向左向右的箭头
        language: 'zh-CN' //语言
    });
    $('img').on('click',function () {

        var src=$(this).attr('src');
        layer.open({
            type: 1,
            content: '<img src="'+src+'" width="100%" height="100%">',
            title: false,
            closeBtn: 0,
            area: 'auto',
            shadeClose: true
        });
    });
    /* 省市区三级联动 */
    function privance() //省
    {
        $.post("{:url('index/need/privance')}", {param1: 'value1'}, function(data, textStatus, xhr) {
            var html;
            for (var i = 0; i<data.length; i++) {
                html += "<option value='"+data[i]['province_id']+"'>"+data[i]['province']+"</option>";
            }
            $('.province').html(html);
            city()
        });
    }


    function city() //市
    {
        var provinceid = $('.province').val(); //省id

        $.post("{:url('index/need/city')}", {province_id: provinceid}, function(data, textStatus, xhr) {
            var html;
            for (var i = 0; i<data.length; i++) {
                html += "<option value='"+data[i]['city_id']+"'>"+data[i]['city']+"</option>";
            }
            $('.city').html(html);
            area();
        });
    }


    function area() //县
    {
        var cityid = $('.city').val(); //市id
//alert(cityid);
        $.post("{:url('index/need/area')}", {city_id: cityid}, function(data, textStatus, xhr) {
            var html;
            for (var i = 0; i<data.length; i++) {
                html += "<option value='"+data[i]['county_id']+"'>"+data[i]['county']+"</option>";
            }
            $('.area').html(html);
        });
    }
    /* 省市区三级联动 end */
    //    $(".province").mouseover(function(){
    //        privance()
    //    });
    $('.province').change(function(event) { //选择省
        city();
        $(".province").removeAttr('onmouseover')
    })
    $('.city').change(function(event) { //选择省
        area();

    });
function getCookie(cookie_name) {
        var allcookies = document.cookie;
		//索引长度，开始索引的位置
        var cookie_pos = allcookies.indexOf(cookie_name);

        // 如果找到了索引，就代表cookie存在,否则不存在
        if (cookie_pos != -1) {
            // 把cookie_pos放在值的开始，只要给值加1即可
            //计算取cookie值得开始索引，加的1为“=”
            cookie_pos = cookie_pos + cookie_name.length + 1; 
            //计算取cookie值得结束索引
            var cookie_end = allcookies.indexOf(";", cookie_pos);
            
            if (cookie_end == -1) {
                cookie_end = allcookies.length;

            }
            //得到想要的cookie的值
            var value = unescape(allcookies.substring(cookie_pos, cookie_end)); 
        }
        return value;
    }

    /* 省市区三级联动 end */
</script>

